package cl.utalca.robot.beans;

import java.util.ArrayList;
import java.util.List;

import cl.utalca.robot.dto.TestCaseDTO;
import cl.utalca.robot.dto.LanguageDTO;
import cl.utalca.robot.dto.TestDTO;
import cl.utalca.robot.logic.ExecuteRobot;
import cl.utalca.robot.services.LanguageService;
	
public class LanguageBean {
	
	private LanguageService languageService = new LanguageService();
	private List<LanguageDTO> languageList;
	private LanguageDTO selectedLanguage;
	
	public LanguageBean()
	{
		languageList = getLanguages();
	}
	
	public List<LanguageDTO> getLanguages()
	{
		List<LanguageDTO> languages = languageService.getLanguages();
		return languages;
	}
	
	public List<LanguageDTO> getLanguageList() {
		return languageList;
	}

	public LanguageDTO getSelectedLanguage() {
		return selectedLanguage;
	}

	public void setSelectedLanguage(LanguageDTO selectedLanguage) {
		this.selectedLanguage = selectedLanguage;
	}
	
	public void testRobot(){
		
		List<TestCaseDTO> testList = new ArrayList<TestCaseDTO>();
		TestDTO programDTO = new TestDTO(selectedLanguage, 
				"na que ver el enunciado aqui", 
				"codigo.java", null , testList);
		
		ExecuteRobot.doTest(programDTO);
	}
	
}